//
//  Status.swift
//  ZHTQWeibo
//
//  Created by ZHTQ on 2018/9/19.
//  Copyright © 2018年 ZHTQ. All rights reserved.
//

import UIKit

class Status: NSObject {
    /// 微博创建时间
    var created_at: String?
    /// 字符串型的微博ID
    var idstr: String?
    /// 微博信息内容
    var text: String?
    /// 微博来源
    var source: String?
    /// 微博作者的用户信息
    var user: User?
    /// 微博的图片
    var pic_urls: [[String:Any]]?
    /// 转发的微博
    var retweeted_status: Status?
    
    init(dict: [String: Any]){
        super.init()
        created_at = dict["created_at"] as? String
        idstr = dict["idstr"] as? String
        text = dict["text"] as? String
        source = dict["source"] as? String
        pic_urls = dict["pic_urls"] as? [[String: Any]]
        
        guard let userDict = dict["user"] as? [String: Any] else{
            return
        }
        user = User(dict: userDict)
        
        guard let retweeted = dict["retweeted_status"] as? [String: Any] else {
            return
        }
        retweeted_status = Status(dict: retweeted)
    }
    
    
    override func setValue(_ value: Any?, forUndefinedKey key: String) {
        
    }
    
    override var description: String{

        return "\(text!)"
    }
    
}
